# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=py3-port-for
_pkgname=port-for
pkgver=0.7.4
pkgrel=0
pkgdesc="Utility and library that helps with local TCP ports management"
url="https://github.com/kmike/port-for"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/fizyk/port-for/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	# Low ports are available on the CI
	.testenv/bin/python3 -m pytest \
		-k 'test_binding_high or not test_binding'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/port_for*.whl
}

sha512sums="
607bc73ffd07dfa4163c3e999c43ab04c481eadfb91d59b593dba270610fa1725c0dd395718d086beefc64d560d3a0805b17908f6d473d97f2c1bc45ea05e181  py3-port-for-0.7.4.tar.gz
"
